package com.utils;

import java.io.InputStream;


import javafx.scene.image.Image;


public enum IconStorage
{
//    APPLICATION("/icons/simulation_server_small.png"),
//    APPLICATION_MEDIUM("/icons/simulation_server_big.png"),
//
//
//    CERT_NEW("cert_new", IconSize.SIZE_16),
//    CERT_TRUSTED("cert_trusted", IconSize.SIZE_16),
//    CERT_REJECTED("cert_rejected", IconSize.SIZE_16),
//    CERT_REVOKED("cert_revoked", IconSize.SIZE_16),
//

   STATUS_RUNNING("ok", IconSize.SIZE_16),
   STATUS_ERROR("fail", IconSize.SIZE_16);

  private final Image icon;


  IconStorage(String path) {
      InputStream in = IconStorage.class.getResourceAsStream(path);
     if (in != null) {
        this.icon = new Image(in);
    } else {
        throw new RuntimeException("Could not find icon:" + name());
    }
  }

  IconStorage(String name, IconSize size) {
      String path = "/icons/" + name + "_icons/" + name + "_icon_" + size.getSize() + ".png";
      InputStream in = IconStorage.class.getResourceAsStream(path);
      if (in != null) {
        this.icon = new Image(in);
    } else {
        throw new RuntimeException("No image found for path:" + path);
    }
  }

  public Image getIcon() {
      return this.icon;
  }
}


